/**
 * Copyright (c) 2011 eelpo.com
 * All rights reserved.
 */
package com.eelpo.cmmp.basic.dao.vo;

import com.eelpo.cmmp.core.wicket.panel.paging.ISort;
import com.eelpo.common.util.BlankUtils;

/**
 * <pre>
 * 
 * 系统配置(Value Object)
 * 
 * </pre>
 * 
 * @author <a href="mailto:Brian@eelpo.com">汪洪州</a>
 * @since 1.0
 */
public class SystemConfig implements ISort {

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = -2292919735363029866L;

	/**
	 * 系统参数Id
	 */
	private String id;

	/**
	 * 系统参数键名
	 */
	private String configKey;

	/**
	 * 系统参数值
	 */
	private String configValue;

	/**
	 * 系统参数描述信息
	 */
	private String description;

	/**
	 * 系统配置提示信息
	 */
	private String hint;

	/**
	 * 排序字段
	 */
	private String sort;

	public SystemConfig() {

	}

	public SystemConfig(String id) {
		this.id = id;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getConfigKey() {
		return configKey;
	}

	public void setConfigKey(String configKey) {
		this.configKey = configKey;
	}

	public String getConfigValue() {
		return configValue;
	}

	public void setConfigValue(String configValue) {
		this.configValue = configValue;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getHint() {
		return hint;
	}

	public void setHint(String hint) {
		this.hint = hint;
	}

	public String getSort() {
		return sort;
	}

	public void setSort(String sort) {
		this.sort = sort;
	}

	public void setSort(String sort, String mode) {
		this.sort = sort.concat(" ").concat(mode);
	}

	@Override
	public boolean equals(Object obj) {
		if (BlankUtils.isBlank(obj) || !(obj instanceof SystemConfig))
			return false;

		if (this == obj)
			return true;

		SystemConfig config = (SystemConfig) obj;

		if (BlankUtils.isBlank(this.id) || BlankUtils.isBlank(config.getId())) {
			return false;
		}

		return this.id.equals(config.getId());
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public String toString() {
		return "[Key=" + configKey + ",Value=" + configValue + "]";
	}
}
